package com.qijian.maindata.domain.query;

import com.baomidou.mybatisplus.annotation.TableName;
import com.qijian.common.utils.mybatis.WhereType;
import com.qijian.common.utils.mybatis.WhereTypeEnum;
import lombok.Data;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Set;


/**
 * 工序工单派单人员对象 查询条件类
 *
 * @author qijian
 * @date 2021-10-09
 */

@Data
@ToString
@TableName("main_process_order_users")
public class ProcessOrderUsersQuery {

    @WhereType(filed = "wu_id")
    private Long wuId;
    @WhereType(filed = "work_id")
    private Long workId;
    @WhereType(filed = "work_id", type = WhereTypeEnum.IN)
    private List<Long> workIds;
    @WhereType(filed = "user_id")
    private Long userId;
    @WhereType(filed = "picture_id")
    private Long pictureId;
    @WhereType(filed = "times")
    private BigDecimal times;
    @WhereType(filed = "prices")
    private BigDecimal prices;
    @WhereType(filed = "receive_time")
    private Date receiveTime;
    @WhereType(filed = "report_time")
    private Date reportTime;
    @WhereType(filed = "check_time", type = WhereTypeEnum.BETWEEN)
    private List<String> checkTimes;
    @WhereType(filed = "status", type = WhereTypeEnum.IN)
    private List<Integer> status;
    @WhereType(filed = "wu_id", type = WhereTypeEnum.IN)
    private Set<Long> ids;

    @WhereType(filed = "wu_id", type = WhereTypeEnum.IN)
    private List<Long> idList;
    @WhereType(filed = "wu_id", type = WhereTypeEnum.NOTIN)
    private Set<Long> idsNot;
    @WhereType(filed = "create_by")
    private String createBy;
    @WhereType(filed = "work_code", tableName = "main_process_order", type = WhereTypeEnum.LIKE)
    private String workCode;
    @WhereType(filed = "user_id", tableName = "main_process_order", type = WhereTypeEnum.IN)
    private List<Long> workUserIds;
    @WhereType(filed = "user_id", tableName = "main_process_order")
    private Long workUserId;
    @WhereType(filed = "nick_name", tableName = "sys_user", type = WhereTypeEnum.LIKE)
    private String nickName;

    @WhereType(filed = "bom_id", tableName = "main_project")
    private Long bomId;
    @WhereType(filed = "project_id", tableName = "main_project")
    private Long projectId;
    @WhereType(filed = "project_no", tableName = "main_project", type = WhereTypeEnum.LIKE)
    private String projectNo;
    @WhereType(filed = "project_name", tableName = "main_project", type = WhereTypeEnum.LIKE)
    private String projectName;
    @WhereType(filed = "status", tableName = "main_project", type = WhereTypeEnum.NOTIN)
    private List<Integer> projectStatusNot;
    @WhereType(filed = "machine_no", tableName = "main_project")
    private String machineNo;
    @WhereType(filed = "process_name", tableName = "main_process_order", type = WhereTypeEnum.LIKE)
    private String processName;
    @WhereType(func = "main_process_order_check.check_content ->> '$[0].itemList[0].checkVal' > 1")
    private Boolean isQtException;
    @WhereType(filed = "process_type", tableName = "main_line_process")
    private String processType;
    @WhereType(filed = "process_type_name", tableName = "main_line_process")
    private String processTypeName;
    @WhereType(filed = "process_type", tableName = "main_line_process", type = WhereTypeEnum.NULL)
    private Boolean processTypeOther;

    @WhereType(deptTableName = "main_process_order", userTableName = "main_process_order")
    private Boolean dataScope;

    @WhereType(func = "main_process_order.work_end_time<main_process_order.update_time and main_process_order.work_end_time < now()")
    private Boolean isEndTime;

    @WhereType(filed = "is_develop", type = WhereTypeEnum.IN)
    private List<Integer> isDevelop;

    //工单类型 1 普通工单  2 数控件工单
    @WhereType(filed = "order_type",tableName = "main_process_order")
    private Integer orderType;

    public void setCheckTimes(List<String> checkTimes) {
        if (checkTimes.size() > 1 && !checkTimes.get(1).contains(":")) {
            checkTimes.set(1, checkTimes.get(1) + " 23:59::59");
        }
        this.checkTimes = checkTimes;
    }

    @WhereType(ignore = true)
    private Long targetUserId;

    @WhereType(filed = "is_ignore")
    private Boolean isIgnore;

    //待验收列表
    @WhereType(filed = "nick_name",type = WhereTypeEnum.LIKE)
    private String workUserName;

    @WhereType(filed = "times")
    private String workTime;

    @WhereType(filed = "prices")
    private String workCost;

    @WhereType(filed = "item_name",tableName = "main_process_order",type = WhereTypeEnum.LIKE)
    private String itemName;
}
